package ink.xiaobaibai.entity;

import com.baomidou.mybatisplus.annotation.*;
import ink.xiaobaibai.common.RoomObj;
import ink.xiaobaibai.common.RoomObjListHandler;
import lombok.Data;
import lombok.EqualsAndHashCode;

import javax.validation.Valid;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Null;
import javax.validation.constraints.Size;
import java.io.Serializable;
import java.util.Date;
import java.util.Set;

/**
 * <p>
 *
 * </p>
 *
 * @author xiaobaibai
 * @since 2021-07-25
 */
@Data
@EqualsAndHashCode(callSuper = false)
@TableName("free_client_user")
public class FreeClientUser implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
     * 免费机器控制用户
     */
    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;

    /**
     * 对应小程序用户id
     */
    @TableField("client_user_id")
    @NotNull
    private Integer clientUserId;

    /**
     * 对应免费机器id
     */
    @TableField("device_id")
    @NotNull
    private Integer deviceId;

    /**
     * 对应的房间对象
     */
    @TableField(value = "room_obj_list", typeHandler = RoomObjListHandler.class)
    @NotNull
    @Size(min = 1)
    @Valid
    private Set<RoomObj> roomObjList;

    /**
     * 备注(保留字段)
     */
    @TableField("remarks")
    private String remarks;

    /**
     * 流程状态
     */
    @TableField("status")
    @Null
    private String status;

    /**
     * 创建时间
     */
    @TableField(value = "create_time", fill = FieldFill.INSERT)
    private Date createTime;

    /**
     * 当前的机器码
     */
    @TableField(exist = false)
    private String deviceCode;


}
